<template>
  <el-dialog title="详细信息" :visible.sync="dialogVisible" class="dialog">
    <el-descriptions direction="vertical" :column="3" border>

      <el-descriptions-item label="真实姓名">{{ info.realName }}</el-descriptions-item>
      <el-descriptions-item label="手机号">{{ info.mobile }}</el-descriptions-item>
      <el-descriptions-item label="身份证号">{{ info.idcard }}</el-descriptions-item>

      <el-descriptions-item label="身份证头像">
        <el-image style="width: 100px; height: 100px" :src="info.idcardImg1" :preview-src-list="srcList">
        </el-image>
      </el-descriptions-item>
      <el-descriptions-item label="身份证国徽">
        <el-image style="width: 100px; height: 100px" :src="info.idcardImg2" :preview-src-list="srcList">
        </el-image>
      </el-descriptions-item>
    </el-descriptions>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="confirm">确 定</el-button>
    </span>

  </el-dialog>
</template>
<script>
import { setTeamRate, setInviteUser } from '@/api/table'
export default {
  data() {
    return {
      innerVisible: false,
      dialogVisible: false,
      innerVisible2: false,
      info: {},
      srcList: [],
      rate: '',
      inviteCode: ''
    }
  },

  methods: {
    show(e) {
      this.info = e
      this.srcList = [this.info.idcardImg1, this.info.idcardImg2]

      this.dialogVisible = true
    },
    confirm() {
      this.$parent.fetchData()
      this.dialogVisible = false
    },
    confirm1() {
      setTeamRate({ userId: this.info.id, rate: this.rate }).then(res => {
        if (res.code === 200) {
          this.innerVisible = false
          this.confirm()
          this.$message({
            message: '成功',
            type: 'success'
          })
        }
      })
    },
    confirm2() {
      setInviteUser({ userId: this.info.id, inviteCode: this.inviteCode }).then(res => {
        if (res.code === 200) {
          this.innerVisible2 = false
          this.confirm()

          this.$message({
            message: '成功',
            type: 'success'
          })
        }
      })
    }
  }
}
</script>
